//
//  AssessViewController.m
//  DeepBreathing
//
//  Created by rimi on 15/12/14.
//  Copyright © 2015年 rimi. All rights reserved.
//

#import "AssessViewController.h"

#import "TextViewController.h"
#import "HeaderView.h"
#import "ControllerManager.h"



@interface AssessViewController ()
@property(nonatomic,strong)UIView *animationView;
@property(nonatomic,assign)NSTimeInterval beginTime;
@property(nonatomic,strong)UIImageView *imaegView;

@end

@implementation AssessViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.imaegView];
    HeaderView *HDV = [[HeaderView alloc]initWithTitleString:@"评估管理" leftImage:@"个人中心按钮_橙色" rightImage:nil color:[UIColor whiteColor]];
    [self.view addSubview:HDV];
    
    
    HDV.LeftDWblock =^(){
        if ([ControllerManager sharedManager].drawerVC.leftOpen == NO) {
             [[ControllerManager sharedManager].drawerVC openLeftDrawer];
        }else {
            [[ControllerManager sharedManager].drawerVC closeLeftDrawer];
        };
    };
//    [self adasd];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    NSArray *array = @[@"查看            结果",@"重新            测试"];
    
    for (int i = 0; i < 2; i++) {
        UIButton *button  = [UIButton buttonWithType:UIButtonTypeCustom];
        button.frame = CGRectMake(50 + 200 * i, 480, 90, 90);
        [button setTitle:array[i] forState:UIControlStateNormal];
        [button.layer setCornerRadius:45];
        [button.layer setMasksToBounds:YES];
        button.titleLabel.lineBreakMode = 0;
        button.titleLabel.textColor = [UIColor whiteColor];
        button.titleLabel.textAlignment = NSTextAlignmentCenter;
        if (i == 0) {
            button.backgroundColor = [UIColor colorWithRed:0.418 green:0.6202 blue:0.4008 alpha:1.0];
            button.tag = 400;
        }else{
            button.backgroundColor = [UIColor colorWithRed:1.0 green:0.5079 blue:0.1192 alpha:1.0];
            button.tag = 401;
        }
        
        [button addTarget:self action:@selector(prentAssess:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button];
    }
  
    

}


-(void)prentAssess:(UIButton *)sender{
    
    TextViewController *TXVC = [[TextViewController alloc]init];
    
    [self.navigationController pushViewController:TXVC animated:YES];
    
}
//-(void)adasd{
//    
//    self.animationView  =[[UIView alloc]initWithFrame:CGRectMake(80, 80, 100, 100)];
//    self.animationView.backgroundColor = [UIColor blueColor];
//    [self.view addSubview:self.animationView];
//    
//    self.beginTime =  CACurrentMediaTime();
//    
//    CADisplayLink *displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(onDisplayLink:)];
//    [displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:UITrackingRunLoopMode];
//    [displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
//    
//    
//    
//}
//
#pragma mark - getter
-(UIImageView *)imaegView{
    if (!_imaegView) {
        _imaegView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 75, 375, 377)];
        _imaegView.image =[UIImage imageNamed:@"123"];
    }
    return _imaegView;
}
////线性差值
//-(CGFloat)interpolateFrom:(CGFloat)from to :(CGFloat)to persent:(CGFloat)persent{
//    
//    
//    return from + (to - from)*persent;
//}
//-(CGFloat)easeOut:(CGFloat)t{
//    
//    
//    
//    return sqrt(1 -(t- 1)*(t-1));
//}
//-(void)onDisplayLink:(CADisplayLink *)display{
//    self.animationView.layer.position  = [[self.animationView.layer presentationLayer] position];
//    //设置center
//    CGFloat fromX= 130;
//    CGFloat fromY = 130;
//    CGFloat toX = 280;
//    CGFloat toY = 400;
//    CGFloat duration = 3;
//    //动画经历了多久
//    CGFloat time = CACurrentMediaTime() - self.beginTime;
//    //当前经历的时间占总时间的百分比
//    CGFloat percant = time/duration;
//    
//    //当前视图的x 和  y
//    //如果超过终点 则直接成终点并且停止
//    
//    if (percant >= 1) {
//        percant = 1;
//        [display invalidate];
//        
//    }
//    percant = [self easeOut:percant];
//    CGFloat x = [self interpolateFrom:fromX to:toX persent:percant];
//    CGFloat y = [self interpolateFrom:fromY to:toY persent:percant];
//    
//    self.animationView.center = CGPointMake(x, y);
//    
//
//    
//    
//}
//
//-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
//    
//    
//    
//}


@end
